package com.huawei.petapp2.provider;


import androidx.appcompat.widget.AppCompatImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.huawei.petapp2.R;
import com.huawei.petapp2.adapter.TestHomeAdapter;
import com.huawei.petapp2.entity.Recomment;


/**
 * Created by 吕氏春秋i 2020/4/30
 * Describe:
 */


public class TwoColumnItemProvider extends BaseItemProvider<Recomment, BaseViewHolder> {
    @Override
    public int viewType() {
        return TestHomeAdapter.TYPE_TWO_COLUMN;
    }

    @Override
    public int layout() {
        return R.layout.app_item_home_two_column;
    }

    @Override
    public void convert(BaseViewHolder helper, Recomment data, int position) {

            helper.setText(R.id.item_goods_price, ( data.getProductName()+""))
                    .setText(R.id.item_goods_name, ( data.getContent()+""))
                    .setText(R.id.item_goods_desc,("已经售出"+data.getSoldNum()));
            Glide.with(mContext)
                    .load(((Recomment) data).getImgs().get(0).getUrl())
                    .dontAnimate()
                    .into((AppCompatImageView) helper.getView(R.id.item_goods_img));

    }
}
